<template>
  <view :style="themeColor">
    <view class="page">
      <view
        class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex changePwdPhone_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-stretch justify-between changePwdPhone_fd0_0'>
          <view class='flex flex-wrap align-center changePwdPhone_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  changePwdPhone_fd0_0_c0_c0'>&#xe794;</text>
          </view>
          <view class='flex flex-wrap align-center'>
            <text class='changePwdPhone_fd0_0_c1_c0'>修改密码</text>
          </view>
          <view class='flex align-center justify-end changePwdPhone_fd0_0_c2'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---修改密码-手机验证-表单flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch changePwdPhone_flex_1">
        <view class='flex flex-wrap align-center changePwdPhone_fd1_0'>
          <text class='changePwdPhone_fd1_0_c0'>新密码</text>
          <benben-input class='flex-sub changePwdPhone_fd1_0_c1' type="text" :focus='true' :placeholder="`请输入新密码`"
            confirm-type="done" :maxlength="12" :password='false' placeholder-style="color:#999;font-size:32rpx"
            v-model="newPwd" />
        </view>
        <view class='flex flex-wrap align-center changePwdPhone_fd1_0'>
          <text class='changePwdPhone_fd1_1_c0'>确认新密码</text>
          <benben-input class='flex-sub changePwdPhone_fd1_0_c1' type="text" :focus='false' :placeholder="`请再次输入新密码`"
            confirm-type="done" :maxlength="12" :password='false' placeholder-style="color:#999;font-size:32rpx"
            v-model="qrPwd" />
        </view>
        <button class='changePwdPhone_fd1_2' @tap.stop="checkPwdFunc()" open-type="contact">完成</button>
      </view>

      <!---修改密码-手机验证-表单flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "newPwd": "",
        "qrPwd": "",
        "mobile": "15533333333",
        "code": "1234"
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        mobile,
        code
      } = options
      if (mobile !== undefined) this.mobile = mobile
      if (code !== undefined) this.code = code
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //校验密码
      async checkPwdFunc() {
        if (!validate(this.newPwd, 'require')) {
          this.$message.info('请输入新密码');
          return false;
        }
        if (!validate(this.newPwd, 'password')) {
          this.$message.info('请输入新密码（6~12位字母+数字）');
          return false;
        }
        if (!validate(this.qrPwd, 'require')) {
          this.$message.info('请输入确认密码');
          return false;
        }
        if (!validate(this.qrPwd, 'password')) {
          this.$message.info('请输入确认密码（6~12位字母+数字');
          return false;
        }
        if (!(this.newPwd == this.qrPwd)) {
          this.$message.info('两次输入密码不一致');
          return false;
        }
        //请求方法
        //数据验证

        let data5caeeba9866aa = await this.$api.post(global.apiUrls.post5caeeba9866aa, {
          password: this.qrPwd,
          account: this.mobile,
          code: this.code,
          account_type: 'mobile'
        });

        if (data5caeeba9866aa.data.code != 1) {
          this.$message.info(data5caeeba9866aa.data.msg);
          return
        }



        this.$store.commit('logout')
        setTimeout(() => {
          uni.reLaunch({
            url: `/pages/dlzc/loginPage/loginPage`
          })
        }, 500)
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #fff;
    background-size: 100% auto;
  }

  .changePwdPhone_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .changePwdPhone_fd0_0_c2 {
    padding: 0rpx 0rpx 0rpx 0rpx;
    width: 100rpx;
  }

  .changePwdPhone_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: var(--benbenFontColor0);
    line-height: 50rpx;
  }

  .changePwdPhone_fd0_0_c0_c0 {
    font-size: 36rpx;
    font-weight: 400;
    color: #333;
  }

  .changePwdPhone_fd0_0_c0 {
    width: 100rpx;
  }

  .changePwdPhone_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
  }

  .changePwdPhone_flex_1 {
    background: #fff;
    font-size: 32rpx;
    background-size: 100% auto !important;
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .changePwdPhone_fd1_2 {
    background: rgba(16, 51, 126, 1);
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: var(--benbenFontColor3);
    width: 686rpx;
    height: 88rpx;
    line-height: 88rpx;
    font-weight: 500;
    margin: 600rpx 0rpx 0rpx 0rpx;
  }

  .changePwdPhone_fd1_1_c0 {
    font-size: 32rpx;
    font-weight: 400;
    font-style: normal;
    color: var(--benbenFontColor0);
    width: 182rpx;
  }

  .changePwdPhone_fd1_0_c1 {
    line-height: 45rpx;
    font-size: 32rpx;
    font-weight: 400;
    color: var(--benbenFontColor0);
  }

  .changePwdPhone_fd1_0_c0 {
    font-size: 32rpx;
    font-weight: 400;
    font-style: normal;
    color: var(--benbenFontColor0);
    margin: 0rpx 48rpx 0rpx 0rpx;
  }

  .changePwdPhone_fd1_0 {
    border-bottom: 1px solid #eee;
    padding: 32rpx 0rpx 32rpx 0rpx;
  }
</style>
